import request from '@/api/request';
import axiosData from '@/api/axios-standingBook';
import amaxios from '@/api/axios-base';
import { post1 } from '@/api/axios-base';
export default {
  // 文件上传
  upload(data, otherData = {}) {
    return request({
      // url: 'common/file/upDown/upload',
      url: `http://localhost:3000/api/upDown/upload`,
      method: 'post',
      data,
      ...otherData
    });
  },

  // 文件上传并返回HTTP地址
  getUploadUrl(data) {
    return request({
      url: 'common/file/upDown/getUploadUrl',
      method: 'post',
      data
    });
  },

  // 文件查看 - 图片形式
  view(fileId) {
    return request({
      url: `common/file/upDown/view?fileId=${fileId}`,
      method: 'get'
    });
  },

  // 文件下载 - 附件形式
  download(fileId) {
    return request({
      url: `common/file/upDown/download?fileId=${fileId}`,
      method: 'get'
    });
  },

  // 播放视频
  videoPlay(fileId) {
    return request({
      url: `common/file/upDown/videoView?fileId=${fileId}`,
      method: 'get'
    });
  },
  // 列配置
  /**
   * @description: 获取表格字段 *代表必填
   * @param {Object}  *
   */
  queryByUrlAndAccountAndOrganizationNo(params) {
    return request.get(`v3/template/fieldConfiguration/queryByUrlAndAccountAndOrganizationNo?url=${params}&account=${sessionStorage.account}`);
  },

  /**
   * @description: 保存表格字段 *代表必填
   * @param {Object}  *
   */
  bind(params) {
    return request.post('v3/template/fieldConfiguration/bind', params);
  },

  /**
   * @description: 可排序表格字段 *代表必填
   * @param {String}  *
   */
  queryByUrl(params) {
    return request.get(`v3/template/fieldConstantController/queryByUrl?url=${params}`);
  },

  /**
   * @description: 获取设备图片 *代表必填
   * @param {String/Number} equipmentCode *
   * @return {Array}
   */
  queryPictureList(params) {
    return axiosData.get(`/v1/equipmentPicture/getPictureByEquipmentCode?equipmentCode=${params}`);
  },

  /**
   * @description: 添加设备图片 *代表必填
   * @param {Object} params *
   * @return {Array}
   */
  addPictureList(params) {
    return axiosData.post1('/v1/equipmentPicture/add', params);
  },
  /**
   * @description: 添加设备图片 *代表必填
   * @param {Object} params *
   * @return {Array}
   */
  addPictureListNew(params) {
    return axiosData.post1('/v1/equipmentPicture/addNew', params);
  },
  /**
   * @description: 删除设备图片 *代表必填
   * @param {String/Number} id *
   * @return {Array}
   */
  delPictureList(params) {
    return axiosData.get(`/v1/equipmentPicture/delById?id=${params}`);
  },

  /**
   * @description: 修改设备图片 *代表必填
   * @param {Object} params *
   * @return {Array}
   */
  editPictureList(params) {
    return axiosData.post('/v1/equipmentPicture/edit', params);
  },

  /**
   * @description: 获取设备文档文件 *代表必填
   * @param {String/Number} equipmentCode *
   * @return {Array}
   */
  queryDocument(params) {
    return axiosData.get(`v1/equipmentFile/getFileByEquipmentCode?equipmentCode=${params}`);
  },

  /**
   * @description: 下载文档文件 *代表必填
   * @param {String/Number} equipmentFileId *
   * @return {Array}
   */
  downPDF(params) {
    return axiosData.get1(`/v1/equipmentFile/getFileById`, params);
  },

  /**
   * @description: 添加设备文档文件 *代表必填
   * @param {Object} params *
   * @return {Array}
   */
  addDocument(params) {
    return axiosData.post1('v1/equipmentFile/add', params);
  },
  /**
   * @description: 添加设备文档文件 *代表必填
   * @param {Object} params *
   * @return {Array}
   */
  addDocumentNew(params) {
    return axiosData.post1('v1/equipmentFile/addNew', params);
  },
  /**
   * @description: 删除设备文档文件 *代表必填
   * @param {String/Number} id *
   * @return {Array}
   */
  delDocument(params) {
    return axiosData.get(`v1/equipmentFile/delById?id=${params}`);
  },

  /**
   * @description: 上传设备视频 *代表必填
   * @param {Object} params *
   * @return {Array}
   */
  addEquipmentVideo(params) {
    return post1('/v1/equipmentVideo/add', params);
  },
  /**
   * @description: 上传设备视频 *代表必填
   * @param {Object} params *
   * @return {Array}
   */
  addEquipmentVideoNew(params) {
    return post1('/v1/equipmentVideo/addNew', params);
  },
  /**
   * @description: 删除设备视频列表 *代表必填
   * @param {String/Number} id *
   * @return {Array}
   */
  delVideoList(params) {
    return amaxios.get(`/v1/equipmentVideo/delById?id=${params}`);
  },
  // deleteEquipmentAndVideo(params) {
  //   return amaxios.get(`/v1/equipment/deleteEquipmentAndVideo?equipmentVideoIdList=${params}`);
  // },
  /**
  * @description: 修改设备视频列表 * 代表必填
    * @param { Object } params *
   * @return { Array }
  * /
editVideoList(params) {
  return amaxios.post("/v1/equipmentVideo/edit", params);
},

/**
 * @description: 获取设备视频id列表 *代表必填
 * @param {String/Number} equipmentCode *
 * @return {Array}
 */
  queryVideoIdList(params) {
    return axiosData.get(`/v1/equipment/getEquipmentVideoIdListByEquipmentCode?equipmentCode=${params}`);
  },
  /**
   * @description: 获取设备视频列表 *代表必填
   * @param {String/Number} equipmentCode *
   * @return {Array}
   */
  queryVideoList(params) {
    return amaxios.post(`/v1/equipmentVideo/queryListByNo`, params);
  },

  /**
   * @description: 获取设备视频 *代表必填
   * @param {String/Number} equipmentVideoId *
   * @return {Array}
   */
  queryVideo(params) {
    return amaxios.get(`/v1/equipmentVideo/getFileById?equipmentVideoId=${params}`);
  }
};
